-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java Assignment3 upload by HaesolChoi #40
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuthMethod 클래스에 한국어보다는 영어로 상수 정의를 하는 게 좋지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AuthMethod 클래스에 한국어보다는 영어로 상수 정의를 하는 게 좋지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
테스트
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안녕하세요 해솔님~
과제 진행하신다고 고생많으셨습니다.
깊은 복사의 개념에 대해 확실히 집고가셨으면 좋겠습니다. 메모리 주소값과 연관있는 굉장히 중요한 지식이에요!
다음번에 과제 제출해주실때는 제출전에 main
함수에서 실행시켜보고 요구사항을 모두 만족하는지 확인해보면 좋을 것 같아요!
3-3과 3-4에 대해서는 다른 방식으로 접근하셔야할 것 같습니다. 기본적으로 인증 방법으로 찾기 위해서는 반복문을 2번 돌아야하지 않을까요?
한번 고민해보시죠!
코드를 작성하실 때 코드 스타일에 대해서도 조금 신경 써주셨으면 좋겠습니다. 인텔리제이의 자동 정렬 기능을 사용해보세요~
메서드, 변수들의 위치, 줄바꿈 등등
깃 커밋의 단위를 좀 더 잘개 쪼개면 좋을 것 같아요!
ex)
- feat: User 클래스 생성 및 필드 작성
- feat: 생성자 생성
- feat: 싱글톤 패턴 구현
- feat: 회원 조회 메서드 구현
- refactor: 회원 조회 메서드 로직 분리
요렇게요!!
커밋 내역만으로 어떤 작업을 했는지 알 수 있다면 추후 협업 과정에서 큰 도움을 받을 수 있을 거에요~!
다음 과제에서는 요구사항을 좀 더 꼼꼼히 읽어보셨으면 좋겠습니다!
그리고 pr을 올리실 때 본인만의 템플릿을 가지고 계시면 좋을 것 같습니다.
ex)
- 내가 중점적으로 생각한 부분
- 작업 내용
- 궁금한 점
- 함께 이야기하고 싶은 부분
|
||
//본인인증 방법 — Enum형으로 정의 | ||
public enum AuthMethod { | ||
지문인증, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
강사님 의견처럼 저도 영어로 상수를 정의하는게 좋을 것 같습니다 ㅋㅋ
import java.util.Arrays; | ||
import java.util.Objects; | ||
|
||
public class Electronic { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일반적으로 코드에도 저마다의 위치가 있는데요.
static
변수- 일반 변수
- 생성자
public
메서드private
메서드
순으로 코드를 작성해봅시다~
private String modelName; | ||
private CompanyName companyName; | ||
private LocalDate dateOfMade; | ||
private AuthMethod[] authMethod; // 본인인증 방법 — 배열로 정의 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사소한거지만 여러개를 담을 수 있으니 변수명에 복수를 사용하는게 어떨까요?
private AuthMethod[] authMethod; // 본인인증 방법 — 배열로 정의 | |
private AuthMethod[] authMethods; // 본인인증 방법 — 배열로 정의 |
private String userPhoneNumber; | ||
private String userEmail; | ||
private String userBirthDate; | ||
private String[] electronicDevices; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요거는 String[]
이 아니라 Electronic[]
이 되어야하지 않을까요??
private LocalDate registerTime; | ||
|
||
//객체 생성시 시스템 시간으로 자동 설정 | ||
public User() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용되지 않고 있는 생성자네요. 과감히 제거해주시죠~
return user; | ||
} | ||
} | ||
throw new IllegalArgumentException("Not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
original.getUserPassword(), | ||
original.getUserBirthDate(), | ||
original.getUserPhoneNumber(), | ||
original.getElectronicDevices() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이렇게 배열을 반환한다면 깊은 복사가 맞을까요?
서로 같은 곳을 참조하고 있지는 않을까요?
import java.util.List; | ||
|
||
public class Electronics { | ||
private static Electronic[] electronicList; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이게 static
인 이유가 있나요?
} | ||
|
||
//3-2 productNo를 통해 인자로 주어진 일련번호에 해당하는 전자제품을 반환하는 함수를 작성 | ||
public Electronic findByProductNo(String productNo) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
마찬가지로 여기서도 Stream
을 활용할 수 있을 것 같습니다.
public Electronic[] groupByAuthMethod(AuthMethod authMethod){ | ||
List<Electronic> groupAuthList = new ArrayList<>(); | ||
for (Electronic electronic : electronicList) { | ||
if (electronic.getAuthMethod().equals(authMethod)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getAuthMethod()
의 반환형은 AuthMethod[]
이고 파라미터로 넘어온 값은 AuthMethod
인데 equals()
로 비교하는게 맞을까요?
실습 문제 3의 꼬리 문제 3,4번을 똑같이 작성해도 별다른 오류나 틀린 건 없어 보여 그대로 제출하는데 이래도 되는 건지...?가 궁금합니다 문제의 의도가 둘 다 똑같이 하라는 건 아닌 거 같아 다르게 뭔가를 할 수 있나 고민했는데 모르겠네요